package cn.swust.designpatternlearningplatform.dao;

import cn.swust.designpatternlearningplatform.dao.sql.TeacherTestDaoSql;
import cn.swust.designpatternlearningplatform.domain.entity.TestPaper;
import org.apache.ibatis.annotations.*;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;

@Mapper
public interface TeacherTestDao {
   @Results(value = {
           @Result(property = "id",column = "id"),
           @Result(property = "paperNumber",column = "paper_number"),
           @Result(property = "testName",column = "test_name"),
           @Result(property = "teacherNumber",column = "teacher_number"),
           @Result(property = "startTime",column = "start_time"),
           @Result(property = "endTime",column = "end_time"),
           @Result(property = "doableTime",column = "doable_time"),
           @Result(property = "topicNumber",column = "topic_number"),
           @Result(property = "testScore",column = "test_score"),
           @Result(property = "publishTime",column = "publishTime"),
           @Result(property = "isPublish",column = "is_publish"),
           @Result(property = "classNumber",column = "class_number"),
           @Result(property = "semester",column = "semester"),

   })
   @SelectProvider(type = TeacherTestDaoSql.class,method = "getPaperListBySemester")
    List<TestPaper> getPaperListBySemester(String semester, String teacherNumber);
    @SelectProvider(type = TeacherTestDaoSql.class,method = "getCompeleteStudent")
    Set<String> getCompeleteStudent(String paperNumber);
    @Results(value = {
            @Result(property = "id",column = "id"),
            @Result(property = "paperNumber",column = "paper_number"),
            @Result(property = "testName",column = "test_name"),
            @Result(property = "teacherNumber",column = "teacher_number"),
            @Result(property = "startTime",column = "start_time"),
            @Result(property = "endTime",column = "end_time"),
            @Result(property = "doableTime",column = "doable_time"),
            @Result(property = "topicNumber",column = "topic_number"),
            @Result(property = "testScore",column = "test_score"),
            @Result(property = "publishTime",column = "publishTime"),
            @Result(property = "isPublish",column = "is_publish"),
            @Result(property = "classNumber",column = "class_number"),
            @Result(property = "semester",column = "semester"),

    })
    @SelectProvider(type = TeacherTestDaoSql.class,method = "getPaperList")
    List<TestPaper> getPaperList(String teacherNumber);
    @UpdateProvider(type = TeacherTestDaoSql.class,method = "updatePaperPublishState")
    void updatePaperPublishState(String s, String paperId, LocalDateTime time);
}
